package com.sinodata.bsm.cicp.collector.net.trap;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Properties;

import org.apache.log4j.Logger;

public class GetTPCResId {
    private Logger logger = Logger.getLogger(GetTPCResId.class.getName());

    private static void loadPropertyFile(Properties prop, String filename) throws Exception {
        File file = new File(filename);
        InputStream inputStream = new FileInputStream(file);
        prop.load(inputStream);
        if (inputStream != null) {
            try {
                inputStream.close();
            } catch (Exception e) {
            }
            inputStream = null;
        }
    }

    public String getTPCResId(String hostName) {

        Properties properties = new Properties();
        try {
            loadPropertyFile(properties, "conf/net/res.properties");
        } catch (Exception e) {
            logger.error(e);
        }
        String resid = properties.getProperty(hostName);
        return resid;
    }
}
